/**
 * 链接单元组件
 */

Component({
  data: {},
  props: {
    label: '',
    content: '',
    logo: '',
  },
  methods: {
    handleOnLongTap() {
      const { content } = this.props;
      my.confirm({
        title: '确认提示',
        content: `复制${content}到剪贴板`,
        success: (res) => {
          const { confirm } = res;
          if (confirm) {
            my.setClipboard({
              text: content,
              success: () => {
                my.showToast({
                  type: 'success',
                  content: '复制成功',
                });
              },
              fail: () => {
                my.showToast({
                  type: 'fail',
                  content: '复制失败',
                });
              }
            });
          }
        }
      });
    }
  },
});
